<?php

namespace Database\Seeders;

use App\Kuafu\Config\Enum\ConfigCacheEnum;
use App\Kuafu\Config\Model\ConfigModel;
use Illuminate\Database\Seeder;
use Illuminate\Support\Facades\Cache;

class ConfigSeeder extends Seeder
{
    /**
     * Run the database seeds.
     *
     * @return void
     */
    public function run()
    {
        $type = 'rmsWeb';

        $insertArr = [
            ['name' => '页面CDN', 'key' => 'cdn', 'value'=> 'https://qa-cdn.51kuafu.com/rms-web/', 'type' => $type, 'remark' => '', 'createdAt' => time(), 'updatedAt' => time()],
            ['name' => '页面版本', 'key' => 'pageVersion', 'value'=> '1', 'type' => $type, 'remark' => '', 'createdAt' => time(), 'updatedAt' => time()],
            ['name' => '请求地址', 'key' => 'baseUrl', 'value'=> 'https://qa-b.51kuafu.com/api/', 'type' => $type, 'remark' => '', 'createdAt' => time(), 'updatedAt' => time()],
        ];

        ConfigModel::query()->insert($insertArr);

        Cache::forget(ConfigCacheEnum::getConfigType($type));
    }
}
